package com.wn.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.wn.bean.Records;
import com.wn.mapper.RecordsMapper;
import com.wn.service.IRecordsService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author yellow Docter
 * @since 2022-05-24
 */
@Service
public class RecordsServiceImpl extends ServiceImpl<RecordsMapper, Records> implements IRecordsService {

    /**
     *  通过 houseId 和 typeId  查询上次记录
     * @param houId
     * @param typeId
     * @return
     */

    @Override
    public Records queryByHouIdAndTypeId(Integer houseId, Integer typeId) {

        QueryWrapper<Records> qr = new QueryWrapper<>();

        qr.eq("house_id",houseId);
        qr.eq("type_id",typeId);

        Records records = this.getOne(qr);

        return records;
    }
}
